import cv2
import matplotlib.pyplot as plt  # plt 用于显示图片

o = cv2.imread("D:\\xiuzhi.jpg")
down = cv2.pyrDown(o)
up = cv2.pyrUp(down)
width = 1605
height = 1070
dim = (width, height)
# resize image
up_resized = cv2.resize(up, dim, interpolation=cv2.INTER_AREA)
diff = up_resized - o
print("o.shape=", o.shape)
print("up.shape=", up.shape)
cv2.imshow("original", o)
cv2.imshow("up", up)
h, w, c = diff.shape
# show
plt.imshow(diff)  # 显示图片
plt.axis('off')  # 不显示坐标轴
plt.show()
cv2.waitKey()
cv2.destroyAllWindows()